<template>
    <el-card shadow="never" class="aui-card--fill">
      <div class="mod-classinfo__stuinfo}">
        <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
          <el-form-item>
            <el-input v-model="dataForm.studentName" placeholder="请输入学生姓名" clearable></el-input>
          </el-form-item>
          <el-form-item>
            <el-button @click="getDataList()">{{ $t('query') }}</el-button>
          </el-form-item>
          <el-form-item>
          <el-button type="info" @click="exportHandle()">{{ $t('export') }}</el-button>
        </el-form-item>
        </el-form>
        <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
          <el-table-column min-width="100" label="学生照片" show-overflow-tooltip header-align="center" align="center">
            <template slot-scope="scope">
              <el-image style="width: 100px; height: 100px" fit="cover" :src="scope.row.headUrl"></el-image>
            </template>
          </el-table-column>
          <el-table-column prop="studentName" label="学生姓名" header-align="center" align="center"></el-table-column>
          <el-table-column prop="className" label="班级名称" header-align="center" align="center"></el-table-column>
          <el-table-column prop="teacherName" label="班主任" header-align="center" align="center"></el-table-column>
          <el-table-column prop="gpa" label="绩点" header-align="center" align="center">
            <template slot-scope="scope">
              <el-tag size="small" type="success">{{ scope.row.gpa }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="testingScore" label="综测分" header-align="center" align="center">
            <template slot-scope="scope">
              <el-tag size="small" type="success">{{ scope.row.testingScore }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="difficultyLevel" label="困难等级" header-align="center" align="center">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.difficultyLevel === 0" size="small" type="info">暂无</el-tag>
              <el-tag v-if="scope.row.difficultyLevel === 1" size="small" type="danger">一般困难</el-tag>
              <el-tag v-if="scope.row.difficultyLevel === 2" size="small" type="danger">中等困难</el-tag>
              <el-tag v-if="scope.row.difficultyLevel === 3" size="small" type="danger">非常困难</el-tag>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          :current-page="page"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="limit"
          :total="total"
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="pageSizeChangeHandle"
          @current-change="pageCurrentChangeHandle">
        </el-pagination>
      </div>
    </el-card>
  </template>
  
  <script>
  import mixinViewModule from '@/mixins/view-module'
  export default {
    mixins: [mixinViewModule],
    data () {
      return {
        mixinViewModuleOptions: {
          getDataListURL: '/classinfo/stuinfo/page',
          getDataListIsPage: true ,
          exportURL: '/classinfo/stuinfo/export'
        },
        dataForm: {
          id: '',
          classInfoId: '',
          studentName: ''
        },
        classInfoList: []
      }
    },
    created() {
      this.getClassInfoList();
    },
    methods: {
      getClassInfoList() {
        this.$http.get("/classinfo/classinfo/list").then(({ data }) => {
          this.classInfoList = data.data;
        });
      },
    }
  }
  </script>
  